package com.game.centerserver.infrastructure.service.impl;

import com.game.centerserver.infrastructure.entity.ServerMasterInfo;
import com.game.centerserver.infrastructure.dao.ServerMasterInfoDao;
import com.game.centerserver.infrastructure.service.ServerMasterInfoService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (ServerMasterInfo)表服务实现类
 *
 * @author makejava
 * @since 2024-11-14 22:33:54
 */
@Service("serverMasterInfoService")
public class ServerMasterInfoServiceImpl implements ServerMasterInfoService {
    @Resource
    private ServerMasterInfoDao serverMasterInfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param ip 主键
     * @return 实例对象
     */
    @Override
    public ServerMasterInfo queryById(String ip) {
        return this.serverMasterInfoDao.queryById(ip);
    }

    @Override
    public List<ServerMasterInfo> query(ServerMasterInfo serverMasterInfo) {
        return serverMasterInfoDao.query(serverMasterInfo);
    }

    /**
     * 新增数据
     *
     * @param serverMasterInfo 实例对象
     * @return 实例对象
     */
    @Override
    public boolean insert(ServerMasterInfo serverMasterInfo) {

        return this.serverMasterInfoDao.insert(serverMasterInfo) > 0;
    }

    /**
     * 修改数据
     *
     * @param serverMasterInfo 实例对象
     * @return 实例对象
     */
    @Override
    public boolean update(ServerMasterInfo serverMasterInfo) {

        return this.serverMasterInfoDao.update(serverMasterInfo) > 0;
    }

    /**
     * 通过主键删除数据
     *
     * @param ip 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String ip) {
        return this.serverMasterInfoDao.deleteById(ip) > 0;
    }
}
